import torch
import torch.nn.functional as F
import torch.nn as nn
import numpy as np
from collections import deque
import random

class MCS(nn.Module):
    def __init__(self, states_nums, hidden_dim, action_nums, lr, gamma, epsilon, target_update_nums, pb_info, pb_info_idx, least_score, capacity, batch_size):
        super(MCS, self).__init__()
        self.states_nums = states_nums
        self.hidden_dim = hidden_dim
        self.action_nums = action_nums
        self.gamma = gamma
        self.epsilon = epsilon
        self.lr = lr
        self.target_update_nums = target_update_nums
        self.loss_func = torch.nn.MSELoss()
        self.pb_info = pb_info
        self.pb_info_idx = pb_info_idx
        self.least_score = least_score
        self.batch_size = batch_size
        self.count = 0

    def generate_episode(self, state, max_iters, path_len, epsilon):
        for cnt in range(max_iters):
            episode = []
            for _ in range(path_len):
                if np.random.rand() < epsilon:
                    print('give up')

